package http_utils.asynctask;


import android.os.AsyncTask;

import http_utils.https.HttpConnect;
import http_utils.interfaces.IHttpPostListener;
import http_utils.utils.LoadingUtils;

import java.util.Map;


public class HttpPostAsyncTask extends AsyncTask<String, Void, String> {
	private IHttpPostListener mPostListener;
	private String mStrUrl;
	private Map<String, Object> mParams;

	public HttpPostAsyncTask(String strUrl, Map<String, Object> params,IHttpPostListener postListener) {
		this.mParams = params;
		this.mStrUrl = strUrl;
		this.mPostListener = postListener;
	}

	@Override
	protected String doInBackground(String... params) {
		String result = null;
		HttpConnect httpConnect = HttpConnect.getInstance();
		result = httpConnect.postConnect(mStrUrl, mParams);
		return result;
	}

	@Override
	protected void onPostExecute(String result) {
		LoadingUtils.progressDialogDismiss();
		mPostListener.responseSuccess(result);
	}
}
